home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 2 / ACE CD 2.iso / FILES / UTILS / AMOSPRO4.DMS / in.adf / Tutorials / AMAL / AMAL_4.AMOS / AMAL_4.amosSourceCode next >
Encoding:
AMOS Source Code  |  1992-09-28  |  5.6 KB  |  182 lines

  1. '*************************** 
  2. '*    AMOS Professional    * 
  3. '*                         * 
  4. '*         AMAL_4          *                 Amal control
  5. '*                         * 
  6. '* (c) Europress Software  * 
  7. '*                         * 
  8. '*     Ronnie Simpson      * 
  9. '*************************** 
  10. '
  11. '------------------------------------------- 
  12. 'Channel 
  13. '------------------------------------------- 
  14. 'assign an amal channel
  15. '
  16. 'As a default all Amal channels are assigned to the relevant sprite numbers, 
  17. 'the Channel command allows channel numbers to be referenced to control  
  18. 'various other activities:-  
  19. '
  20. 'Assign a channel to control a bob 
  21. '
  22. '       Channel 1 To Bob 5       (assign channel 1 to bob 5) 
  23. '
  24. 'Assign a channel to control Screen Display
  25. '
  26. '       Channel 2 To Screen Display 0      (assign channel 1 to screen 0)
  27. '
  28. '       X and Y registers hold screen hardware coordinates 
  29. '
  30. 'Assign a channel to control Screen Offset 
  31. '
  32. '       Channel 8 To Screen Offset 1     (assign channel 8 to screen 1)
  33. '
  34. '       X and Y registers hold screen offset position
  35. '
  36. 'Assign a channel to control Screen size 
  37. '
  38. '       Channel 2 To Screen Size 0     (assign channel 2 to screen 0)
  39. '
  40. '       X and Y registers hold width and height sizes
  41. '
  42. 'Assign a channel to control a Rainbow 
  43. '
  44. '       Channel 8 To Rainbow 1         (assign channel 8 to rainbow 1) 
  45. '
  46. '       X holds rainbow base    (change this to rotate colours)
  47. '       Y holds start position  (change this to bounce rainbow)
  48. '       A holds rainbow Height  (measured in scan lines) 
  49. '
  50. '------------------------------------------- 
  51. 'Amal Freeze 
  52. '------------------------------------------- 
  53. 'freeze 1 or all amal channels 
  54. '
  55. 'Used without parameters Amal Freeze will halt all existing Amal programs, if
  56. 'the channel number is added then only that channel will be frozen.
  57. '
  58. '           Amal Freeze 3   (halt only channel number 3) 
  59. '           Amal Freeze     (halt all Amal programs) 
  60. '
  61. 'A call to Amal On will restart your programs. 
  62. '
  63. '------------------------------------------- 
  64. 'Amal Off
  65. '------------------------------------------- 
  66. 'Stop 1 or all Amal programs 
  67. '
  68. 'Used without parameters Amal Off will stop all existing Amal programs, if 
  69. 'the channel number is added then only that channel will be stopped.This 
  70. 'instruction erases the program from memory and would have to be re-defined
  71. 'before it can be used again.
  72. '
  73. '           Amal Off 5   (delete only channel number 5)
  74. '           Amal Off     (delete all Amal programs)
  75. '
  76. '
  77. '------------------------------------------- 
  78. 'Update every
  79. '------------------------------------------- 
  80. 'Slow down Amal programs 
  81. '
  82. 'Each Amal program is stepped through each 1/50th. of a second if a large
  83. 'number of objects or large sized graphics are being handled then this amount
  84. 'of time may not be enough for the updating to take place. The Update Every
  85. 'instruction compensates for this by delaying the update process in steps  
  86. 'of 1/50th. of a second. 
  87. '
  88. 'eg.        Update Every 2    (update every 2 Vbls.) 
  89. '
  90. 'Please note that more processor time will now be availiable for your Basic
  91. 'programs.   
  92. '
  93. '------------------------------------------- 
  94. 'Channan 
  95. '------------------------------------------- 
  96. 'test an Amal animation
  97. '
  98. 'This function tests the Amal animation of any channel and Returns either
  99. '-1 (true) if the sequence is active or 0 (false if it is not. 
  100. '
  101. '         A=Chanan(2)             (check anim status of channel 2) 
  102. '         While Chanan(8) : Wend  (wait for animation to be completed) 
  103. '
  104. '------------------------------------------- 
  105. 'Chanmv
  106. '------------------------------------------- 
  107. 'test an Amal Move sequence
  108. '
  109. 'Similar to the above Chanan but checks the Amal channel for the status of 
  110. 'object movement, Returns either -1 (true) if the sequence is still being
  111. 'moved or 0 (false) if movement is complete. 
  112. '
  113. '         M=Chanmv(4)  
  114. '         If Not Chanmv(9) Then Amal 9,A$ : Amal On 9
  115. '
  116. '------------------------------------------- 
  117. 'Amalerr 
  118. '------------------------------------------- 
  119. 'error position in string
  120. '
  121. 'As an aid to de-bugging your Amal strings, Amalerr returns the position of
  122. 'the error (Measured in characters). If an error occurs in your Amal program 
  123. 'go to direct mode and type:-
  124. '
  125. '               Print Mid$(A$,Amalerr,10)
  126. '                          | 
  127. '                          +--->enter name of your Amal string 
  128. '
  129. 'This will print out the 10 characters following the error and hopefully 
  130. 'pinpoint your mistakes easily.
  131. '------------------------------------------- 
  132. 'EXAMPLE 
  133. '------------------------------------------- 
  134. Rem *** tidy up screen and grab a sprite 
  135. '
  136. Colour Back $3
  137. Screen Open 0,320,256,4,Lowres : Flash Off 
  138. Palette $3,$FFF,$77,$FF4 : Curs Off : Cls 0 : Hide 
  139. For N=0 To 3 : For C=0 To 3 : Colour N*4+C+16, Colour(C) : Next : Next 
  140. Paper 0 : Pen 1 : Print "." : Get Sprite 1,0,0 To 7,7
  141. Cls 0
  142. '
  143. Rem *** define rainbow to be animated with amal
  144. '
  145. Set Rainbow 0,0,200,"(3,-1,15)","","(1,1,15)"
  146. Rainbow 0,0,50,200
  147. A$="Loop: For R0=1 To 150; Let X=R0;Let Y=R0*2;Let A=R0;Next R0;"
  148. A$=A$+"For R0=1 To 150; Let X=150-R0;Let Y=300-R0;Let A=150-R0;Next R0;"
  149. A$=A$+"Pause Jump Loop"
  150. Channel 15 To Rainbow 0
  151. Amal 15,A$
  152. Amal On 15
  153. '
  154. Rem *** define amal program to control starfield 
  155. '
  156. B$="Loop:Let X=280;Let Y=140;Let R0=Z(6)-3;Let R1=Z(6)-3;"
  157. B$=B$+"For R9=1 To 40;Let X=X+R0;LY=Y+R1;Next R9;"
  158. B$=B$+"Pause Jump Loop"
  159. '
  160. Rem *** assign 15 channels to the starfield
  161. '
  162. For N=0 To 14
  163.    Sprite N,0,0,1
  164.    Amal N,B$
  165.    Wait 10
  166.    Amal On N
  167. Next 
  168. '
  169. Rem *** plot some stars
  170. '
  171. Ink 2
  172. For N=1 To 150
  173.    Plot Rnd(320),Rnd(256)
  174.    Wait 5
  175. Next 
  176. '
  177. Rem *** wait for mouse key to end
  178. '
  179. Pen 3 : Locate 0,22 : Centre "Press any mouse key to quit"
  180. Do 
  181.    If Mouse Key Then Direct 
  182. Loop